[libcxx] Attempt to fix __throw_future_error in C++03 Summary: Hi Marshall, Could you please test this patch and see if you run into the same linker errors we talked about? I can't reproduce on linux or OS X. Hopefully you can't find any problems and we can fix the C++03 bot. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13337 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249192 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/future b/include/future index 0f8fe57..367eab9 100644 --- a/include/future +++ b/include/future 
@@ -512,9 +512,8 @@  virtual ~future_error() _NOEXCEPT;  };   -template <future_errc _Ev> -_LIBCPP_ALWAYS_INLINE -void __throw_future_error() +inline _LIBCPP_ALWAYS_INLINE +void __throw_future_error(future_errc _Ev)  {  #ifndef _LIBCPP_NO_EXCEPTIONS  throw future_error(make_error_code(_Ev)); @@ -657,7 +656,7 @@  {  unique_lock<mutex> __lk(this->__mut_);  if (this->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));  this->__state_ |= base::__constructed | base::ready;  __cv_.notify_all(); @@ -674,7 +673,7 @@  {  unique_lock<mutex> __lk(this->__mut_);  if (this->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));  this->__state_ |= base::__constructed;  __thread_local_data()->__make_ready_at_thread_exit(this); @@ -733,7 +732,7 @@  {  unique_lock<mutex> __lk(this->__mut_);  if (this->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  __value_ = _VSTD::addressof(__arg);  this->__state_ |= base::__constructed | base::ready;  __cv_.notify_all(); @@ -745,7 +744,7 @@  {  unique_lock<mutex> __lk(this->__mut_);  if (this->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  __value_ = _VSTD::addressof(__arg);  this->__state_ |= base::__constructed;  __thread_local_data()->__make_ready_at_thread_exit(this); @@ -1142,7 +1141,7 @@  : __state_(__state)  {  if (__state_->__has_future_attached()) - __throw_future_error<future_errc::future_already_retrieved>(); + __throw_future_error(future_errc::future_already_retrieved);  __state_->__add_shared();  __state_->__set_future_attached();  } @@ -1244,7 +1243,7 @@  : __state_(__state)  {  if (__state_->__has_future_attached()) - __throw_future_error<future_errc::future_already_retrieved>(); + __throw_future_error(future_errc::future_already_retrieved);  __state_->__add_shared();  __state_->__set_future_attached();  } @@ -1445,7 +1444,7 @@  promise<_Rp>::get_future()  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  return future<_Rp>(__state_);  }   @@ -1454,7 +1453,7 @@  promise<_Rp>::set_value(const _Rp& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value(__r);  }   @@ -1465,7 +1464,7 @@  promise<_Rp>::set_value(_Rp&& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value(_VSTD::move(__r));  }   @@ -1476,7 +1475,7 @@  promise<_Rp>::set_exception(exception_ptr __p)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_exception(__p);  }   @@ -1485,7 +1484,7 @@  promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value_at_thread_exit(__r);  }   @@ -1496,7 +1495,7 @@  promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value_at_thread_exit(_VSTD::move(__r));  }   @@ -1507,7 +1506,7 @@  promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_exception_at_thread_exit(__p);  }   @@ -1605,7 +1604,7 @@  promise<_Rp&>::get_future()  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  return future<_Rp&>(__state_);  }   @@ -1614,7 +1613,7 @@  promise<_Rp&>::set_value(_Rp& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value(__r);  }   @@ -1623,7 +1622,7 @@  promise<_Rp&>::set_exception(exception_ptr __p)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_exception(__p);  }   @@ -1632,7 +1631,7 @@  promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_value_at_thread_exit(__r);  }   @@ -1641,7 +1640,7 @@  promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)  {  if (__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __state_->set_exception_at_thread_exit(__p);  }   @@ -2063,9 +2062,9 @@  packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)  {  if (__p_.__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  if (__p_.__state_->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  #ifndef _LIBCPP_NO_EXCEPTIONS  try  { @@ -2085,9 +2084,9 @@  packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)  {  if (__p_.__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  if (__p_.__state_->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  #ifndef _LIBCPP_NO_EXCEPTIONS  try  { @@ -2107,7 +2106,7 @@  packaged_task<_Rp(_ArgTypes...)>::reset()  {  if (!valid()) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __p_ = promise<result_type>();  }   @@ -2192,9 +2191,9 @@  packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)  {  if (__p_.__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  if (__p_.__state_->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  #ifndef _LIBCPP_NO_EXCEPTIONS  try  { @@ -2215,9 +2214,9 @@  packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)  {  if (__p_.__state_ == nullptr) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  if (__p_.__state_->__has_value()) - __throw_future_error<future_errc::promise_already_satisfied>(); + __throw_future_error(future_errc::promise_already_satisfied);  #ifndef _LIBCPP_NO_EXCEPTIONS  try  { @@ -2238,7 +2237,7 @@  packaged_task<void(_ArgTypes...)>::reset()  {  if (!valid()) - __throw_future_error<future_errc::no_state>(); + __throw_future_error(future_errc::no_state);  __p_ = promise<result_type>();  }